<?php
	session_start();
	require 'include/configDB.php';

	$id_tahun_ajaran = $_GET['tahun_ajaran']; //id
	$query_tahun_ajaran = mysql_query("SELECT * FROM tahun_ajaran WHERE id='$id_tahun_ajaran' ");
	$tahun_ajaran_data = mysql_fetch_assoc($query_tahun_ajaran);
	$tahun_ajaran = $tahun_ajaran_data['tahun_ajaran'];
	$kelas = $_GET['kelas'];
	$id_jurusan = $_GET['jurusan']; //id
	$query_jurusan = mysql_query("SELECT * FROM jurusan WHERE id='$id_jurusan'");
	$jurusan_data = mysql_fetch_assoc($query_jurusan);
	$jurusan = $jurusan_data['nama'];
	$no_kelas = $_GET['no_kelas'];
	$query_kelas = mysql_query("SELECT * FROM kelas WHERE tingkat='$kelas' AND id_jurusan='$id_jurusan' AND nomor='$no_kelas'" );
	$kelas_data = mysql_fetch_assoc($query_kelas);
	$semester = $_GET['semester'];
	$matpel = $_GET['matpel'];
	$query_matpel = mysql_query("SELECT * FROM mata_pelajaran WHERE id='$matpel'");
	$matpel_data = mysql_fetch_assoc($query_matpel);	
	$keterangan = $_GET['keterangan'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Nilai Akademik</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
</script>

<script type="text/javascript" src="jconfirmaction.jquery.js"></script>
<script type="text/javascript">
	
	$(document).ready(function() {
		$('.ask').jConfirmAction();
	});
	
</script>

<script language="javascript" type="text/javascript" src="niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="niceforms-default.css" />
<style>
	<?php include 'include_style.php'; ?>
</style>
</head>
<body>
<div id="main_container">

	<?php include 'header.php'; ?>
    
    <div class="main_content">
                
                    
    <div class="center_content">  
		
    
	
    <div class="left_content">
    
    		<?php include 'left_content.php'; ?>
    		<?php include 'calendar.php' ; ?>

    </div>  
    
    <div class="right_content">
    <h2>Edit Nilai Akademik</h2>
		<form method="post" action="include/edit_nilai_matpel.php">  
		<table>
			<tr>
				<td>
					Tahun Ajaran 
				<td>
					:
				</td>
				</td>
				<td colspan="7">
					<?=$tahun_ajaran?>
				</td>
			</tr>
			<tr>
				<td>
					Kelas 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$kelas?>
				</td>
				<td>
					Jurusan 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$jurusan?>
				</td>
				<td></td>

				<td>
					<?=$no_kelas?>
				</td>
			</tr>
			<tr>	
				<td>
					Semester 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$semester?>
				</td>
			</tr>
			<tr>	
				<td>
					Nama Mata Pelajaran 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$matpel_data['nama']?>
				</td>
			</tr>
			<tr>	
				<td>
					Tipe Nilai 
				</td>
				<td>
					:
				</td>
				<td>
					<select name="tipeNilai" id="tipeNilai">
						<option value="NULL">---------Pilih----------</option>
						<option value="Ulangan" <?php echo ($_GET['tipe_nilai'] == "Ulangan") ? "selected" : ""; ?>>Ulangan</option>
						<option value ="Tugas" <?php echo ($_GET['tipe_nilai'] == "Tugas") ? "selected" : ""; ?>>Tugas</option>
						<option value= "Ujian" <?php echo ($_GET['tipe_nilai'] == "Ujian") ? "selected" : ""; ?>>Ujian</option>
						<option value= "Nilai AKhir" <?php echo ($_GET['tipe_nilai'] == "Nilai AKhir") ? "selected" : ""; ?> >Nilai AKhir</option>	
					</select>
				</td>
			</tr>
			<tr>	
				<td>
					Nilai-ke
				</td>
				<td>
					:
				</td>
				<td>
					<?=$keterangan?>
				</td>
			</tr>
		</table>
			<input hidden type="text" name="tahun_ajaran" id="tahun_ajaran" value="<?php echo $tahun_ajaran_data['id'] ?>"/>
			<input hidden type="text" name="id_kelas" id="id_kelas" value="<?php echo $kelas_data['id'] ?>"/>
			<input hidden type="text" name="semester" id="semester" value="<?php echo $semester ?>"/>
			<input hidden type="text" name="tipe_nilai" id="tipe_nilai" value="<?php echo $tipe_nilai ?>"/> 
			<input hidden type="text" name="matpel" id="matpel" value="<?php echo $matpel_data['id'] ?>"/> 
			<input hidden type="text" name="keterangan" id="keterangan" value="<?php echo $keterangan ?>"/>  
		</br>
		</br>
		<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
			<thead>
				<tr>
					<th scope="col" class="rounded">No</th>
					<th scope="col" class="rounded">NIS</th>
					<th scope="col" class="rounded">Nama Siswa</th>
					<th scope="col" class="rounded">Nilai</th>
				</tr>
			</thead>
				<?php
					$id = $kelas_data['id'];
					$tipe_nilai = $_GET['tipe_nilai'];
					$query_nilai = mysql_query("SELECT * FROM nilai WHERE id_kelas='$id' AND tipe_nilai='$tipe_nilai' AND keterangan='$keterangan' ");
				?>
			<tbody>
				<?php
						$i = 1;
						while($nilai_data = mysql_fetch_assoc($query_nilai))
						{
							$id_siswa = $nilai_data['id_siswa'];
							$query_siswa = mysql_query("SELECT * FROM siswa WHERE NIS='$id_siswa'");
							$siswa_data = mysql_fetch_assoc($query_siswa);
						 echo 
						 '
						 	<tr>
						 		<td>'.$i.'</td>
								<td>'.$siswa_data['NIS'].'</td>
								<td>'.$siswa_data['nama'].'</td>
								<td><input type="text" name="nilai-'.$siswa_data['NIS'].'" id="nilai" value="'.$nilai_data['nilai'].'"></td>
							</tr>
						 
						 ';
						 $i++;
						}
				?>
	
			</tbody>
		</table>
		
		<input type="submit" name="submit" class="menuitem_red" value="Simpan"/>
     	
    </div><!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
    
    	    	<?php include 'footer.php'; ?>

    </div>

</div>		
</body>
</html>
</html>